package com.mayuhao.userteacher.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mayuhao.userteacher.entity.CssChooseCourse;
import com.mayuhao.userteacher.entity.CssStudentVO;
import com.mayuhao.userteacher.entity.UserTeacher;
import com.mayuhao.userteacher.service.IUserTeacherService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 马宇豪
 * @description 请修改方法描述
 * @methodName
 * @params
 * @paramType
 * @return
 * @date 2022/10/31 0031 下午 2:05
 * @email 1757442521@qq.com
 **/
@RestController

public class UserTeacherController {
    @Resource
    private IUserTeacherService teacherService;

    /**
     * @return com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.mayuhao.userteacher.entity.UserTeacher>
     * @description 请修改方法描述
     * @methodName findPage
     * @params [pageNum, pageSize, searchId, searchName]
     * @paramType [java.lang.Integer, java.lang.Integer, java.lang.String, java.lang.String]
     * @author 马宇豪
     * @date 2022/10/31 0031 下午 2:05
     * @email 1757442521@qq.com
     **/
    @GetMapping("/teachercourse")
    public Page<UserTeacher> teacherCourse(
            @RequestParam(defaultValue = "1") Integer pageNum,
            @RequestParam(defaultValue = "7") Integer pageSize,
            @RequestParam String teacherId,
            @RequestParam(defaultValue = "") String searchId,
            @RequestParam(defaultValue = "") String searchName) {
        return teacherService.teacherCourse(pageNum, pageSize, teacherId, searchId, searchName);
    }

    /**
     * @return java.util.List<com.mayuhao.userteacher.entity.UserTeacher>
     * @description 请修改方法描述
     * @methodName selectCourse
     * @params [teacherId]
     * @paramType [java.lang.String]
     * @author 马宇豪
     * @date 2022/10/31 0031 下午 4:38
     * @email 1757442521@qq.com
     **/
    @GetMapping("/selectCourse/{teacherId}")
    public List<UserTeacher> selectCourse(@PathVariable String teacherId) {
        return teacherService.selectCourse(teacherId);
    }

    /**
     * @return com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.mayuhao.userteacher.entity.CssStudentVO>
     * @description 请修改方法描述
     * @methodName boundStudentPage
     * @params [pageNum, pageSize, courseId, searchId, searchName]
     * @paramType [java.lang.Integer, java.lang.Integer, java.lang.String, java.lang.String, java.lang.String]
     * @author 马宇豪
     * @date 2022/10/31 0031 下午 7:04
     * @email 1757442521@qq.com
     **/
    @GetMapping("/boundstudentpage")
    public Page<CssStudentVO> boundStudentPage(
            @RequestParam(defaultValue = "1") Integer pageNum,
            @RequestParam(defaultValue = "7") Integer pageSize,
            @RequestParam String courseId,
            @RequestParam(defaultValue = "") String searchId,
            @RequestParam(defaultValue = "") String searchName) {
        return teacherService.boundStudentPage(pageNum, pageSize, courseId, searchId, searchName);
    }

    /**
     * @return boolean
     * @description 请修改方法描述
     * @methodName savecourseScore
     * @params [chooseCourse]
     * @paramType [com.mayuhao.userteacher.entity.CssChooseCourse]
     * @author 马宇豪
     * @date 2022/10/31 0031 下午 8:46
     * @email 1757442521@qq.com
     **/
    @PutMapping("/savecoursescore")
    public boolean savecourseScore(@RequestBody CssChooseCourse chooseCourse) {

        return teacherService.myUpdate(chooseCourse);

    }


}
